package com.gxa.modules.communityManagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.common.utils.PageUtils;
import com.gxa.common.utils.Query;
import com.gxa.modules.communityManagement.entity.StorageRoomManagement;
import com.gxa.modules.communityManagement.mapper.StorageRoomManagementMapper;
import com.gxa.modules.communityManagement.service.StorageRoomManagementService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class StorageRoomManagementServiceImpl extends ServiceImpl<StorageRoomManagementMapper, StorageRoomManagement> implements StorageRoomManagementService {

    @Override
    public PageUtils queryByPage(Map<String, Object> params) {
        String storageRoom = (String)params.get("storageRoom");
        String communityId = (String)params.get("communityId");


        IPage<StorageRoomManagement> page = this.page(new Query<StorageRoomManagement>().getPage(params),
                new QueryWrapper<StorageRoomManagement>().like(StringUtils.isNotEmpty(storageRoom),"storage_room",storageRoom)
                        .eq(StringUtils.isNotEmpty(communityId),"community_id",communityId)
        );
        return new PageUtils(page);
    }



}
